<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>自定义插件</title>
  <script src="jQuery/jquery-3.7.1.js"></script>
  <script src="1505.js"></script>
</head>
<body>
  <button id="btn">点击设置奇偶行不同的背景与文字颜色</button>
  <table border="1">
     <thead>
       <tr>
        <th>序号</th>
        <th>姓名</th>
        <th>年龄</th>
        <th>性别</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>1</td>
        <td>王平</td>
        <td>17</td>
        <td>男</td>
      </tr>
      <tr>
        <td>2</td>
        <td>李丽</td>
        <td>19</td>
        <td>男</td>
      </tr>
      <tr>
        <td>3</td>
        <td>张兰</td>
        <td>18</td>
        <td>女</td>
      </tr>
      <tr>
        <td>4</td>
        <td>容刚</td>
        <td>17</td>
        <td>男</td>
      </tr>
    <tbody>
 </table>
  <script>
    $(function(){
      $('#btn').click(function(){
        $('table').tableColor({
          'tbody tr:even': {
            background: 'lightpink'
          },
          'tbody tr:odd': {
            background: 'blue', 
            color: '#fff'
          }
        });
      });
    });
  </script>
</body>
</html>


